package day240111;

import java.util.Random;
import java.util.Scanner;

public class Guess {
    public static void main(String[] args) {

        Random random = new Random();
        int randomNumber = random.nextInt(101);

        for (int i=0;i<5;i++){
            System.out.println("您还有"+(5-i)+"次机会!");
            System.out.println("请输入猜的数字：->");
            Scanner scanner = new Scanner(System.in);
            int next = scanner.nextInt();
            if(next > randomNumber){
                System.out.println("Sorry,too big");
            }
            else if (next < randomNumber){
                System.out.println("Sorry,too small");
            }
            else {
                System.out.println("You win!");
                break;
            }
        }
    }
}
